<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head th:include="common">
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class="modal fade" id="myAddModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    新增页面
                </h4>
            </div>
            <div class="modal-body">
                <form id="addForm" >
                    <input type="hidden" class="form-control" name="id" id="id">
                    <div class="input-group">
                        <span class="input-group-addon">系列活动名称</span>
                        <input type="hidden" class="form-control" name="activityId">
                        <input type="text" class="form-control" name="activityName">
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                </button>
                <button type="button" class="btn btn-primary" onclick="addActive()">
                    提交
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<button class="btn btn-primary btn-lg"   data-toggle="modal" data-target="#myAddModal">新增</button>
</body>
<script>
    $('#myAddModal').on('hidden.bs.modal', function () {

        document.querySelector('#addForm').reset();

    });
    $("#myAddModal").modal("show");

    function addActive(){
        $.ajax({
            url:"/goodsConsummer/addActive",
            data:$("#addForm").serialize(),
            success:function(){
                alert("成功");
                $("#myAddModal").modal("hide");
            }
        })
    }
</script>
</html>